<template>
  <n-config-provider  :theme="appStore.theme==='dark' ? darkTheme : null" :locale="locale" style="height: 100%;">
    <n-loading-bar-provider>
      <n-dialog-provider>
        <n-notification-provider>
          <n-message-provider>
            <NaiveProviderContent></NaiveProviderContent>
            <router-view></router-view>
          </n-message-provider>
        </n-notification-provider>
      </n-dialog-provider>
    </n-loading-bar-provider>
  </n-config-provider>

</template>

<script setup lang="ts">
import {useDialog, useLoadingBar, useMessage, useNotification} from "naive-ui";
import {defineComponent, h, ref} from "vue";
import {useAppStore} from "@/sotre/modules/app";
import {darkTheme, zhCN} from 'naive-ui'
const locale = ref(zhCN)
const appStore =useAppStore()

//定义新组建 实现挂载
const NaiveProviderContent = defineComponent({
  setup() {
    window.$message = useMessage();
    window.$dialog = useDialog();
    window.$notification =useNotification()
    window.$loadingBar = useLoadingBar()
  },
  render() {
    return h('div')
  },
})

</script>

<style scoped>
</style>
